package com.cloud.core.db.mapper;

import com.cloud.core.db.SqlProvider;
import com.cloud.core.db.entity.ConfigAdEntity;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import java.sql.SQLException;
import java.util.List;

/**
* code generate
*/
@Mapper
public interface ConfigAdMapper {

    /**
    * count
    */
    @SelectProvider(type = SqlProvider.class, method = "count")
    int count(ConfigAdEntity entity);

    /**
    * 按照主键查询
    */
    @Select("select * from config_ad where id=#{id}")
    ConfigAdEntity selectByPrimaryKey(@Param("id") long id) throws SQLException;

    /**
     * 按照条件查询
     */
    @SelectProvider(type=SqlProvider.class,method="selectByExample")
    List<ConfigAdEntity> selectByExample(ConfigAdEntity entity) throws SQLException;

    /**
    * 插入数据库
    */
    @InsertProvider(type = SqlProvider.class, method = "insert")
    boolean insert(ConfigAdEntity entity);

    /**
    * 根据主键更新数据库
    */
    @UpdateProvider(type = SqlProvider.class, method = "updateByKey")
    boolean updateByKey(ConfigAdEntity entity);

    /**
    * 根据主键删除数据库
    */
    @Delete("delete from config_ad where id=#{id}")
    boolean deleteByKey(@Param("id")long id);
}